{% if ansible_distribution == "Ubuntu" and ansible_distribution_version is version(ubuntu_version,"<") %}
auto lo
iface lo inet loopback

auto {{ interface }}
iface {{ interface }} inet static
address {{ address }}
netmask {{ netmask }}
gateway {{ gateway }}
dns-search {{ search }}
dns-nameservers {{ dns1 }} {{ dns2 }}
{% endif %}

{% if ansible_distribution == "Debian" %}
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug {{ interface }}
iface {{ interface }}  inet static
address {{ address }}
netmask {{ netmask }}
gateway {{ gateway }}
dns-search {{ search }}
dns-nameservers {{ dns1 }} {{ dns2 }}
{% endif %}
